using UnityEngine;
using System.Collections;

public class BombDrop : MonoBehaviour 
{
	public static int multiplier = 1;
	public int speed = 50;
	public int counter = 0;
	public AudioSource Catch;
	
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		Vector3 moveDirection = new Vector3(0,-1,0);
		Vector3 newPosition = moveDirection *(speed * Time.deltaTime);
		transform.position = transform.position + newPosition;
	}
	
	void OnCollisionEnter(Collision collision)
	{
		if(collision.rigidbody)
		{
			Destroy(gameObject);
			audio.Play();
			updateScore();
			updateCounter();
		}
    }
	
	void updateScore()
	{
		LevelGUI.score += 50 * multiplier;
	}
	
	void updateCounter()
	{
		if(counter <= 1000)
		{
			counter+= 50 * multiplier;
		}
		else if(counter == 1000 && DestructionScript.lives < 3)
		{
			DestructionScript.lives++;
			counter = 0;
			multiplier--;
		}
	}
}
